{extend name="index/index"}
{block name="mycss"}
<link href="/static/index/css/pic.css" rel="stylesheet">
<link href="/static/index/css/pic1.css" rel="stylesheet">
<link href="/static/index/css/style.css" rel="stylesheet" type="text/css" media="all"/>
{/block}

{block name="fjs"}
<script type="text/javascript">
    var now = new Date();
    var beginTime = now.getTime();
    var b = 1;
    var stime = "1534990869";
    setInterval(function () {
        stime++;
    }, 1000);
</script>
{/block}

{block name="main"}
<div style="background-color: red;">
</div>
{/block}

{block name="main1"}
<div class="box-topic" data-lkid="15">
    <div class="w1200">
        <div class="topic-wrap h-lg roll-box " id="NO08758">
            <div class="roll-wrap">
                <div class="clearfix" style="width: 1300px;">
                    <div class="qv-index">
                        <div class="qv-back"
                             style="background-image: url(&quot;http://icon.qiantucdn.com///20180720/26cd10bb0784eac43ab099679eb933182&quot;);">
                            <!---->
                            <div class="qv-share"><i class="icon icon-fenxiang"></i>
                                <div class="shareContent handle-share">
                                    <div class="Arrow"></div>
                                    <ul class="img-share bdsharebuttonbox bdshare-button-style0-16"
                                        data-bd-bind="1535432758792">
                                        <a href="javascript:void (0);" title="分享到QQ好友" data-cmd="qzone" class="bds_qzone"><i></i>QQ</a>
                                        <a href="javascript:void (0);" title="分享到新浪微博" data-cmd="tsina" class="bds_tsina "><i></i>微博</a> 
                                        <a href="javascript:void (0);" title="分享到花瓣" data-cmd="huaban" class="bds_huaban"><i></i>花瓣</a>
                                    </ul>
                                </div>
                            </div>
                            <div class="qv-text">
                                <div class="qv-attention"><span>关注<br><strong class="">{$fol}</strong></span></div>
                                <div class="qv-bean"><span>粉丝<br><strong class="fas-num">{$fas}</strong></span></div>
                            </div>
                            {if condition="($res.icon)"}
                            <div class="qv-via"
                                 style="background-image: url(&quot;http://pdyc9epam.bkt.clouddn.com/{$res.icon}&quot;);"></div>
                            </div>
                            {else /}
                            <div class="qv-via"
                                 style="background-image: url(&quot;static/default.jpg&quot;);"></div>
                            </div>
                            {/if}
                        <div class="qv-rowName"><h4 class="qv-name">{$name}</h4></div>
                        {if condition= "($name==$Request.session.name)"}
                            <div class="qv-homeBtn"><!----> <!---->
                                    <a class=" qt-btn btn-green-linear" style="margin-top: 10px;width: 100px;height: 40px;line-height: 40px;color: #fff" href="{:url('index/personal/edit')}" >个人资料</a>
                            </div>
                        {elseif condition="($Request.session.uid)" /}
                            <div class="qv-homeBtn">
                                {if condition="($status)"}
                                <a class="att-btn qt-btn btn-green-linear" data-id="{$res.id}" style="margin-top: 10px;width: 100px;height: 40px;line-height: 40px;color: #fff">取消关注</a>
                                {else /}
                                <a class="att-btn qt-btn btn-green-linear" data-id="{$res.id}" style="margin-top: 10px;width: 100px;height: 40px;line-height: 40px;color: #fff">关注</a>
                                {/if}
                            </div>
                        {else /}
                            <div class="qv-homeBtn"><!----> <!---->
                                    <a href="{:url('index/login/index')}" class=" qt-btn btn-green-linear" data-id="{$res.id}" style="margin-top: 10px;width: 100px;height: 40px;line-height: 40px;color: #fff">登录并关注</a>
                            </div>
                        {/if}
                        {if condition="($name==$Request.session.name)"}
                        <nav id="qv-nav">
                            <ul>
                                <a href="{:url('index/details/home',['name'=>$name])}"><li class="router-link-exact-active active active">作品</li></a>
                                <li class=""><a href="{:url('index/details/collect')}">收藏</a></li>
                                <a href="{:url('index/details/attention')}"><li class="">关注</li></a>
                            </ul>
                        </nav>
                        {else /}
                        <nav id="qv-nav">
                            <ul>
                                <a href="{:url('index/details/home',['name'=>$name])}"><li class="router-link-exact-active active active" style="font-size: 20px" >作品</li></a>
                            </ul>
                        </nav>
                        {/if}
                    </div>

                    <!--首页遍历-->
                    {if condition="empty($data)"}
                    <!--END图片遍历-->
                        <a href="{:url('index/index/index')}"  ><img src="/static/details.jpg" alt=""></a>
                    {else/}
                    {volist name="data" id="v" key="k"}
                        <div class="qt-card-primary wrap-list roll-list fl">
                            <div class="card-img">
                                <a href="{:url('index/details/newpic',['id'=>$v['id']])}" target="_blank" class="clickL  " data-id="15-0-0">
                                <div class="card-trait">
                                    <div class="card-tag-business "></div>
                                </div>
                                <img class="" src="http://pdyc9epam.bkt.clouddn.com/{$v['icon']}?imageMogr2/thumbnail/540x720>/gravity/North/crop/270x360/format/jpg/blur/1x0/quality/75|imageslim" alt="" width="268" height="356" >
                                <div class="card-bg"></div>
                                <div class="card-handle">
                                </div>
                            </a>
                            </div>
                            <div class="card-tag  isYC"></div>
                            <p class="card-title">{$v['desc']}</p>
                            <a href="#" class="card-title card-intro" target="_blank">
                            <span class="glyphicon glyphicon-download-alt ">下载数量:{$v['sold']}</span> &nbsp;&nbsp;
                            <span class="glyphicon glyphicon-gift ">收藏数量:{$v['house']}</span></a>
                        </div>
                    {/volist}
                    {/if}
                    {$page}
                </div>
            </div>
        </div>
    </div>
</div>


{/block}


{block name="myjs"}
<script>
    $('.att-btn').click(function(){
        var fid=$(this).attr('data-id');
        attAjax(fid);
    })

    //执行关注和取消关注
    function attAjax(fid)
    {
        var fas = $('.fas-num').html();
        $.ajax({
            type:'post',
            dataType:'json',
            data:{'fid':fid},
            url:'/attention',
            success:function(data){
                if(data.status){
                    toastr.success('关注成功');
                    $('.att-btn').html('取消关注');
                    $('.fas-num').html(parseInt(fas)+1);
                }else{
                    toastr.success('取关成功');
                    $('.att-btn').html('点击关注');
                    $('.fas-num').html(parseInt(fas)-1);
                }
            },
            error:function(){
                toastr.error('网络错误,请重试');
            }
        })
    }

    $('.house-btn').click(function(){
        var gid =$(this).attr('data-id');
        houseAjax(gid);
        return false;
    })

    function houseAjax(gid)
    {
        $.ajax({
            type:'post',
            dataType:'json',
            data:{'gid':gid},
            url:'/house',
            success:function(data){
                if(data.status){
                    alert(data.info);
                }else{
                    alert(data.info);
                }
            },
            error:function(){

            }
        })
    }
</script>
{/block}